import QtQuick 2.1
import QtGraphicalEffects 1.0
import QtQuick.Controls 1.1
import QtQuick.Controls.Styles 1.1

Item {
    id: rootBox
    width: 50
    height: 50
    property int radius: 0

    signal close

    function hideMiniWindow(){
        pinButton.active = false
        mainView.hide()
        mainView.recordCurrentVisible("false")
    }

    property int textMargin: 8

    function isPinned(){
        return pinButton.active
    }

    Rectangle {
        id: frame

        width: parent.width
        anchors.fill:parent
        radius: rootBox.radius
        clip: true

        gradient:Gradient {
            GradientStop { position: 0.8; color: "#15A0F5" }
            GradientStop { position: 0.9; color: "#FFFFFF" }
        }

        Item {
            id: title
            anchors.top: frame.top
            //anchors.verticalCenter: parent.verticalCenter
            anchors.left: frame.left
            anchors.right: frame.right
            height: 26

            ImageButton {
                id: closeButton
                anchors.verticalCenter: parent.verticalCenter
                anchors.right: parent.right
                anchors.rightMargin: 8
                normal_image: "images/close_normal.png"
                hover_image: "images/close_hover.png"
                press_image: "images/close_press.png"
                onClicked: rootBox.close()
            }
        }
    }
}

